ViewBox as a Basic List Control

Description

You can format a ViewBox to look and act like a List Control.

images/lc.png
A ViewBox control in the form of List control.

For more information on creating a ViewBox that looks like a List Control watch this video or follow the guide below.

Create a ViewBox that Acts like a List Control.

  1. In the UX Builder open the Properties page. In the UX Properties section click on the button next to the 'Style name' property.

    images/lc2.png
  2. From the Location menu select the 'System' option. Select the 'iOS7' style and click OK,

    images/lc3.png
  3. Open the UX Controls page. In the page's toolbar check the 'Mobile' checkbox.

    images/lc4.png
  4. Open the Panels menu. Click on the [Panel Card] option to add a Panel Card to the component.

    images/lc5.png
  5. Highlight the Panel Card and open the 'Data Controls' menu. Click on [ViewBox] to add a ViewBox control to the Panel Card.

    images/lc6.png
  6. Highlight the ViewBox control. In the properties list on the right scroll down to the ViewBox Properties section. Check the 'Fill container' property.

    images/lc7.png
  7. Click the button next to the 'ViewBox properties' property in order to open the ViewBox Builder.

    images/lc8.png
  8. On the 'Data Source' pane click the button next to the 'ViewBox type' property and select 'Data'.

    images/lc9.png
  9. Set the 'Datasource type' property in the ViewBox Data section to 'Static JSON'.

    images/lc10.png
  10. Click the button next to the 'Static JSON' property.

    images/lc11.png
  11. Click the 'Sample data' button in the lower left and select the 'Menu choices' option.

    images/lc12.png
  12. Click OK.

    images/lc13.png
  13. Open the ViewBox Layout pane and click the 'Add Item' button.

    images/lc14.png
  14. In the 'Category' list select 'Data Controls'. In the 'Control' list select [Label]. Highlight the 'MenuName' and 'Image' data fields on the right and click OK.

    images/lc15.png
  15. In the ViewBox Layout tree highlight the Image field and click the blue 'up' arrow in the toolbar to move it to the top of the tree.

    images/lc16.png
  16. In the 'Image' field's properties list on the right click the button next to the 'Control type' property. Select [CSSIcon-DataBound: Image] and click OK.

    images/lc17.png
  17. Highlight both fields in the tree and click the 'Add item' button again.

    images/lc18.png
  18. In the 'Category' list select 'Containers'. From the 'Control' list select the [ListRowContainer] option and click 'Insert Around'.

    images/lc19.png
  19. At the top of the ViewBox Layout pane check the 'Freeform editor' option. The code should look like this.

    images/lc21.png
  20. Open the 'Items' pane. Highlight the '_AARow' item. In the Javascript section click the button next to the onClick property.

    images/lc22.png
  21. Add the following javascript to the onClick event and click OK:

    alert('you clicked on: '+v);
    images/lc23.png
  22. Open the ViewBox Properties pane. In the Scrolling section check the 'Drag scrolling' checkbox.

    images/lc24.png
  23. Set the 'Drag scrolling axis' property to 'Vertical' and click OK.

    images/lc25.png
  24. Run the component in Live Preview. The ViewBox should appear like a List Control.

    images/lc.png
  25. When you click on a row the onClick event should fire and state which row was clicked on.

    images/lc26.png
  26. The vertical scrollbar should work.

    images/lc27.png